package org.jivesoftware.smackx.muc;

import java.util.Iterator;
import org.jivesoftware.smackx.Form;
import org.jivesoftware.smackx.FormField;
import org.jivesoftware.smackx.packet.DiscoverInfo;
import org.jivesoftware.smackx.packet.DiscoverInfo.Identity;

public class RoomInfo
{
  private String room;
  private String description = "";
  private String subject = "";
  private int occupantsCount = -1;
  private int affiliationsCount = -1;
  private boolean membersOnly;
  private boolean moderated;
  private boolean nonanonymous;
  private boolean passwordProtected;
  private boolean persistent;
  private boolean allowInvites;
  private boolean publicRoom;
  private String roomName = null;
  private int maxUsers = 0;
  private String owner;

  RoomInfo(DiscoverInfo paramDiscoverInfo)
  {
    this.room = paramDiscoverInfo.getFrom();
    this.membersOnly = paramDiscoverInfo.containsFeature("muc_membersonly");
    this.moderated = paramDiscoverInfo.containsFeature("muc_moderated");
    this.nonanonymous = paramDiscoverInfo.containsFeature("muc_nonanonymous");
    this.passwordProtected = paramDiscoverInfo.containsFeature("muc_passwordprotected");
    this.persistent = paramDiscoverInfo.containsFeature("muc_persistent");
    this.publicRoom = paramDiscoverInfo.containsFeature("muc_public");
    this.allowInvites = paramDiscoverInfo.containsFeature("muc_allowinvites");
    Form localForm = Form.getFormFrom(paramDiscoverInfo);
    Object localObject2;
    if (localForm != null)
    {
      localObject1 = localForm.getField("muc#roominfo_description");
      this.description = ((localObject1 == null) || (!((FormField)localObject1).getValues().hasNext()) ? "" : (String)((FormField)localObject1).getValues().next());
      localObject2 = localForm.getField("muc#roominfo_subject");
      this.subject = ((localObject2 == null) || (!((FormField)localObject2).getValues().hasNext()) ? "" : (String)((FormField)localObject2).getValues().next());
      FormField localFormField1 = localForm.getField("muc#roominfo_occupants");
      this.occupantsCount = (localFormField1 == null ? -1 : Integer.parseInt((String)localFormField1.getValues().next()));
      FormField localFormField2 = localForm.getField("muc#roominfo_maxusers");
      this.maxUsers = (localFormField2 == null ? 0 : Integer.parseInt((String)localFormField2.getValues().next()));
      FormField localFormField3 = localForm.getField("muc#roominfo_affiliations");
      this.affiliationsCount = (localFormField3 == null ? 0 : Integer.parseInt((String)localFormField3.getValues().next()));
      FormField localFormField4 = localForm.getField("muc#roominfo_owner");
      this.owner = ((localFormField4 == null) || (!localFormField4.getValues().hasNext()) ? "" : (String)localFormField4.getValues().next());
    }
    Object localObject1 = paramDiscoverInfo.getIdentities();
    if (((Iterator)localObject1).hasNext())
    {
      localObject2 = (DiscoverInfo.Identity)((Iterator)localObject1).next();
      this.roomName = ((DiscoverInfo.Identity)localObject2).getName();
    }
  }

  public String getRoom()
  {
    return this.room;
  }

  public String getRoomName()
  {
    return this.roomName;
  }

  public String getOwner()
  {
    return this.owner;
  }

  public String getDescription()
  {
    return this.description;
  }

  public String getSubject()
  {
    return this.subject;
  }

  public int getOccupantsCount()
  {
    return this.occupantsCount;
  }

  public int getAffiliationsCount()
  {
    return this.affiliationsCount;
  }

  public boolean isMembersOnly()
  {
    return this.membersOnly;
  }

  public boolean isModerated()
  {
    return this.moderated;
  }

  public boolean isNonanonymous()
  {
    return this.nonanonymous;
  }

  public boolean isPasswordProtected()
  {
    return this.passwordProtected;
  }

  public boolean isPersistent()
  {
    return this.persistent;
  }

  public boolean isPublic()
  {
    return this.publicRoom;
  }

  public boolean isAllowInvites()
  {
    return this.allowInvites;
  }

  public int getMaxUsers()
  {
    return this.maxUsers;
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smackx.muc.RoomInfo
 * JD-Core Version:    0.6.1
 */